using System;
using System.Collections.Generic;
using System.Text;
using Utility;
using DAL;
using DTO;
namespace BUS
{
   public class tbTinhTrangGiaoHangBUS
    {
       public static void Insert(tbTinhTrangGiaoHang tinhtranggiaohang)
        {
            tbTinhTrangGiaoHangDAL ttghDAL = new tbTinhTrangGiaoHangDAL();
            ttghDAL.Insert(tinhtranggiaohang);
        }
       public static void Update(tbTinhTrangGiaoHang tinhtranggiaohang)
        {
            tbTinhTrangGiaoHangDAL ttghDAl = new tbTinhTrangGiaoHangDAL();
            ttghDAl.Update(tinhtranggiaohang);
        }
        public static void Delete(int iD)
        {
            tbTinhTrangGiaoHangDAL ttghDAl = new tbTinhTrangGiaoHangDAL();
            ttghDAl.Delete(iD);
        }
       public static tbTinhTrangGiaoHangCollection Get(string where, int pageindex, int pagesize, string orderby, string orderdirection, out int total)
        {
            tbTinhTrangGiaoHangDAL ttghDAL = new tbTinhTrangGiaoHangDAL();
            return ttghDAL.Get(where, pageindex, pagesize, orderby, orderdirection, out total);
        }
       public static tbTinhTrangGiaoHangCollection GetAll()
        {
            int total = 0;
            Criteria cri = new Criteria();
            tbTinhTrangGiaoHangDAL ttghDAL = new tbTinhTrangGiaoHangDAL();
            return ttghDAL.Get(cri.Criter, 0, 0, tbTinhTrangGiaoHangColumns.mattgh.ToString(), OrderDirection.ASC.ToString(), out total);
        }
       public static tbTinhTrangGiaoHang GetByID(int iD)
        {
            int total = 0;
            Criteria cri = new Criteria();
            cri.add(Condition.AND, tbTinhTrangGiaoHangColumns.mattgh.ToString(), Condition.EQUAL, iD);
            tbTinhTrangGiaoHangDAL ttghDAL = new tbTinhTrangGiaoHangDAL();
            tbTinhTrangGiaoHangCollection ttghCollection = ttghDAL.Get(cri.Criter, 0, 0, tbTinhTrangGiaoHangColumns.mattgh.ToString(), OrderDirection.ASC.ToString(), out total);
            if (ttghCollection.Count > 0)
                return ttghCollection[0];
            return null;
        }
       public static tbTinhTrangGiaoHangCollection GetLimited(int number)
        {
            int total = 0;
            Criteria cri = new Criteria();
            tbTinhTrangGiaoHangDAL ttghDAL = new tbTinhTrangGiaoHangDAL();
            return ttghDAL.Get(cri.Criter, 1, number, tbTinhTrangGiaoHangColumns.mattgh.ToString(), OrderDirection.DESC.ToString(), out total);
        }
       public static tbTinhTrangGiaoHangCollection GetPromotion(int number)
        {
            int total = 0;
            Criteria cri = new Criteria();
            tbTinhTrangGiaoHangDAL ttghDAL = new tbTinhTrangGiaoHangDAL();
            return ttghDAL.Get(cri.Criter, 1, number, tbTinhTrangGiaoHangColumns.mattgh.ToString(), OrderDirection.DESC.ToString(), out total);
        }
    }
}
